import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class code3_2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] ch = in.next().toCharArray();
        StringBuilder str = new StringBuilder();//模拟栈
        for(char x:ch) {
            if(str.length()!=0&&x==str.charAt(str.length()-1)) str.deleteCharAt(str.length()-1);
            else str.append(x);
        }
        System.out.print(str.length()==0 ? 0 : str.toString());
    }
}
